package ypmits.components.buttons {
	import ypmits.components.buttons.event.ButtonEvent;

	import flash.display.Sprite;

	/**
	 * @author Dave Lenz
	 */
	public class MinimizeButton extends Sprite implements IButton {
		private var square : Sprite;

		public function MinimizeButton( ) {
			draw( );
		}

		
		private function draw() : void {
			var back : Sprite = new Sprite( );
			back.graphics.beginFill( 0xFFFFFF, 0 );
			back.graphics.drawRect( 0, 0, 20, 20 );
			addChild( back );

			square = new Sprite( );
			square.graphics.beginFill( 0xFFFFFF, 1 );
			square.graphics.drawRect( -10, -2, 20, 4 );
			square.graphics.endFill( );
			square.x = 10;
			square.y = 10;
			addChild( square );			

			addEventListener( ButtonEvent.MOUSE_OVER, mouseOverHandler );
			addEventListener( ButtonEvent.MOUSE_OUT, mouseOutHandler );
			buttonMode = true;
			mouseChildren = false;
		}

		
		public function mouseOverHandler(e : ButtonEvent) : void {
			var evt : ButtonEvent = new ButtonEvent( ButtonEvent.MOUSE_OVER );
			evt.displayobject = square;
			dispatchEvent( evt );
		}

		
		public function mouseOutHandler(e : ButtonEvent) : void {
			var evt : ButtonEvent = new ButtonEvent( ButtonEvent.MOUSE_OUT );
			evt.displayobject = square;
			dispatchEvent( evt );
		}
	}
}


class SingletonEnforcer {
}